package com.qzsoft.zhjd.asphalt.modules.asphaltdata.dto;

import java.math.BigDecimal;
import java.util.Date;

import com.fasterxml.jackson.annotation.JsonFormat;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;

/**
 * @ClassName ProduceSievePassRateDto
 * @Description 关键筛孔通过率
 * @author linhuawei
 * @since 2021-08-16
 */
@Data
@EqualsAndHashCode(callSuper = false)
@NoArgsConstructor
@AllArgsConstructor
@Builder
@ToString
public class ProduceSievePassRateDto {

    /**
     * 生产时间
     */
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd")
    private Date dischargeTime;

    /**
     * 筛孔通过率
     */
    private BigDecimal value;

    /**
     * 前三天筛孔通过率均值
     */
    private BigDecimal threeDaysValue;

    /**
     * 均差
     */
    private BigDecimal difference;

    public BigDecimal getDifference() {
        if (null != value && null != threeDaysValue) {
            difference = value.subtract(threeDaysValue);
        } else {
            difference = null;
        }
        return difference;
    }

}
